
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  s = " " + s;
  int la = 1, lb = 1;
  map<char, int> mpa, mpb; // 统计字符a 以及字符b  出现的次数
  ll ans = 0;
  for (int i = 1; i <= n; i++) { // 枚举右端点
    mpa[s[i]]++;
    mpb[s[i]]++;
    while (mpa['a'] >= a) { // 动态移动左端点
      mpa[s[la]]--;
      la++;
    }
    // 右端点在i时候，左端点必须小于la    l<la
    while (mpb['b'] >= b) {
      mpb[s[lb]]--;
      lb++;
    }
    // 右端点在i时候，左端点必须大于等于lb   l >= lb
    ans += max(0, la - lb);
    // cout << i << ' ' << la << ' ' << lb << ' ' << lb-la << endl;
  }
  cout << ans;
}